package com.linx.system.domain.hk;

import com.linx.system.domain.SysUser;
import lombok.Data;

import java.util.Date;

/**
 * HKPerson 海康人员信息
 */
@Data
public class HKPerson {


    /**
     * 人员ID
     */
    private String personId;

    /**
     * 人员名称
     */
    private String personName;
    /**
     * 性别 1：男；2：女；0：未知
     */
    private String gender;
    /**
     * 海康组织编码
     */
    private String orgIndexCode;
    /**
     * 出生日期
     */
    private Date birthday;
    /**
     * 	手机号
     */
    private String phoneNo;
    /**
     * 电子邮件
     */
    private String email;
    /**
     * 	证件类型
     */
    private String certificateType;
    /**
     * 证件号码
     */
    private String certificateNo;
    /**
     * 工号
     */
    private String jobNo;


    public HKPerson(SysUser sysUser) {
        this.personId = String.valueOf(sysUser.getUserId());
        this.personName = sysUser.getUserName();
        if (sysUser.getSex() != null && sysUser.getSex().equals("0")){
            this.gender = "1";
        }else if (sysUser.getSex() != null && sysUser.getSex().equals("1")){
            this.gender = "2";
        }else {
            this.gender = "0";
        }
        // TODO 组织编码暂时写死
        this.orgIndexCode = "000000";
        this.phoneNo = sysUser.getPhonenumber() == null ? "" : sysUser.getPhonenumber();
        this.email = sysUser.getEmail() == null ? "" : sysUser.getEmail();
        if (sysUser.getIdCardNo() != null) {
            this.certificateNo = sysUser.getIdCardNo();
            this.certificateType = "111";
        }
        this.jobNo = sysUser.getWorkNum() == null ? "" : sysUser.getWorkNum();
    }
}
